package Cordiali_Es2;

import java.io.IOException;
import java.lang.ArithmeticException;

import arjuna.JavaSim.Distributions.ExponentialStream;
import arjuna.JavaSim.Distributions.RandomStream;
import arjuna.JavaSim.Distributions.SeedsData;

/**
 * Returns a number from a hyper exponential distribution with the given mean
 * and standard deviation.
 */

public class HyperExponential2OrderStream extends RandomStream {

	/**
	 * Create stream with mean 'm' and standard deviation 'sd'.
	 */
	private double p;
	ExponentialStream e;

	public HyperExponential2OrderStream(double m, double p) {
		super();
		this.p = p;
		// Mean = m;
		e = new ExponentialStream(m);
	}

	public HyperExponential2OrderStream(double m, double p, SeedsData seeds) {
		super(seeds.MSeed, seeds.LSeed, seeds.series);
		this.p = p;
		// Mean = m;
		e = new ExponentialStream(m, seeds.MSeed, seeds.LSeed, seeds.series);
	}

	public double getNumber() throws IOException, ArithmeticException {
		return p * e.getNumber() + (1 - p) * e.getNumber();
	}

	@Override
	public SeedsData GetSeedsData() {
		return e.GetSeedsData();
	}
};
